import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import App from './App.vue'
import router from './router'
import 'element-plus/dist/index.css'
import './assets/var.scss'
import * as echarts from 'echarts'
import axios from 'axios'
import mitt from 'mitt'
import vant from 'vant';
import 'vant/lib/index.css';
import $ from 'jquery'
import { add, sub } from '@/assets/js/header.js'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import api from './config/index'

import { setCopyDrective } from './utils/directive'

const app = createApp(App)

app.config.globalProperties.$demoe = 'demo'
app.config.globalProperties.$echarts = echarts;
app.config.globalProperties.$mitt = mitt();

axios.defaults.baseURL = 'http://localhost:3000'
app.config.globalProperties.$http = axios;
app.use(createPinia())
app.use(vant)
app.use(router)
app.use(ElementPlus)
app.directive('focus', {
    // 当被绑定的元素挂载到 DOM 中时……
    mounted(el) {
      // 聚焦元素
        el.focus
    }
  })
setCopyDrective(app)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.mount('#app')


